<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta charset="UTF-8">

<link href="${pageContext.request.contextPath}/jquery/bootstrap_3.3.0/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery/jquery-1.11.1-min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery/bootstrap_3.3.0/js/bootstrap.min.js"></script>
<%--自动补全资源--%>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery/bs_typeahead/bootstrap3-typeahead.min.js"></script>
<%--日历资源--%>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery/bootstrap-datetimepicker-master/locale/bootstrap-datetimepicker.zh-CN.js"></script>
<link href="${pageContext.request.contextPath}/jquery/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css" type="text/css" rel="stylesheet" />
<script type="text/javascript">
	//默认情况下取消和保存按钮是隐藏的
	var cancelAndSaveBtnDefault = true;
	
	$(function(){
		//日历设置
		$(".mydateDown").datetimepicker({
			language:"zh-CN",
			format:"yyyy-mm-dd",
			autoclose:1,
			minView:"month",
			initialDate:new Date(),
			todayBtn:true,
			clearBtn:true//需要手动在插件内汉化
		});

		$("#remark").focus(function(){
			if(cancelAndSaveBtnDefault){
				//设置remarkDiv的高度为130px
				$("#remarkDiv").css("height","130px");
				//显示
				$("#cancelAndSaveBtn").show("2000");
				cancelAndSaveBtnDefault = false;
			}
		});
		
		$("#cancelBtn").click(function(){
			//显示
			$("#cancelAndSaveBtn").hide();
			//设置remarkDiv的高度为130px
			$("#remarkDiv").css("height","90px");
			cancelAndSaveBtnDefault = true;
		});
		
		// $(".remarkDiv").mouseover(function(){
		// 	$(this).children("div").children("div").show();
		// });
		$("#remarkFatherDiv").on("mouseover",".remarkDiv",function (){
			$(this).children("div").children("div").show();
		});
		// $(".remarkDiv").mouseout(function(){
		// 	$(this).children("div").children("div").hide();
		// });
		$("#remarkFatherDiv").on("mouseout",".remarkDiv",function (){
			$(this).children("div").children("div").hide();
		});
		// $(".myHref").mouseover(function(){
		// 	$(this).children("span").css("color","red");
		// });
		$("#remarkFatherDiv").on("mouseover",".myHref",function (){
			$(this).children("span").css("color","red");
		});
		// $(".myHref").mouseout(function(){
		// 	$(this).children("span").css("color","#E6E6E6");
		// });
		$("#remarkFatherDiv").on("mouseout",".myHref",function (){
			$(this).children("span").css("color","#E6E6E6");
		});
		//添加备注信息
		$("#saveRemarkBtn").click(function (){
			var noteContent = $.trim($("#remark").val());
			if (noteContent==""){
				alert("备注不能为空!");
				return;
			}
			var customerId="${customer.id}";
			var lis="";
			$.ajax({
				url:"${pageContext.request.contextPath}/customerRemark/insertCustomerRemarkByMap",
				data:{
					noteContent:noteContent,
					customerId:customerId
				},
				type:"post",
				dataType:"json",
				success:function (data){
					if (data.errorInfo.errorCode=="1"){
						var customer = data.customer;
						lis+="<div id=\"firstDiv_"+customer.id+"\" class=\"remarkDiv\" style=\"height: 60px;\">";
						lis+="<img title=\"${sessionScope.sessionUser.name}\" src=\"${pageContext.request.contextPath}/image/user-thumbnail.png\" style=\"width: 30px; height:30px;\">";
						lis+="<div style=\"position: relative; top: -40px; left: 40px;\" >";
						lis+="<h5 id=\"h5_"+customer.id+"\">"+noteContent+"</h5>";
						lis+="<font color=\"gray\">客户</font> <font color\=\"gray\">-</font> <b>${customer.name}</b> <small id=\"small_"+customer.id+"\" style=\"color: gray;\"> "+customer.createTime+" 由${sessionScope.sessionUser.name}创建</small>";
						lis+="<div style=\"position: relative; left: 500px; top: -30px; height: 30px; width: 100px; display: none;\">";
						lis+="<a class=\"myHref\" name=\"editA\" remarkId=\""+customer.id+"\" href=\"javascript:void(0);\"><span class=\"glyphicon glyphicon-edit\" style=\"font-size: 20px; color: #E6E6E6;\"></span></a>";
						lis+="&nbsp;&nbsp;&nbsp;&nbsp;";
						lis+="<a class=\"myHref\" name=\"deleteA\" remarkId=\""+customer.id+"\" href=\"javascript:void(0);\"><span class=\"glyphicon glyphicon-remove\" style=\"font-size: 20px; color: #E6E6E6;\"></span></a>";
						lis+="</div>";
						lis+="</div>";
						$("#remarkBeforeDiv").after(lis);
						$("#remark").val("");
						scrollToTop();
					}else{
						alert(data.errorMessage);
					}
				}
			});
		});
		//显示修改备注窗口
		$("#remarkFatherDiv").on("click","a[name='editA']",function (){
			$("#editRemarkModal").modal("show");
			var remarkId = $(this).attr("remarkId");
			$("#hiddenId").val(remarkId);
			var h5Value = $("#h5_"+remarkId).text();
			$("#noteContent").val(h5Value);
		});
		//修改备注
		$("#updateRemarkBtn").click(function (){
			var remarkId = $("#hiddenId").val();
			var noteContent = $.trim($("#noteContent").val());
			if (noteContent==""){
				alert("修改内容不能为空！");
				return;
			};
			$.ajax({
				url:"${pageContext.request.contextPath}/customerRemark/updateCustomerRemarkById",
				data:{
					remarkId:remarkId,
					noteContent:noteContent
				},
				type:"post",
				dataType:"json",
				success:function (data){
					if (data.errorInfo.errorCode=="1"){
						$("#h5_"+remarkId).text(noteContent);
						$("#small_"+remarkId).text(" "+data.customerRemark.editTime+" 由${sessionScope.sessionUser.name}修改");
						$("#editRemarkModal").modal("hide");
					}else{
						alert(data.errorMessage);
					}
				}
			});
		});
		//删除备注内容
		$("#remarkFatherDiv").on("click","a[name='deleteA']",function (){
			var remarkId = $(this).attr("remarkId");
			$.ajax({
				url:"${pageContext.request.contextPath}/customerRemark/deleteCustomerRemarkById",
				data:{
					id:remarkId
				},
				type:"post",
				dataType:"json",
				success:function (data){
					if (data.errorCode=="1"){
						$("#firstDiv_"+remarkId).remove();
					}else{
						alert(data.errorMessage);
					}
				}
			});
		});
		//弹出删除交易窗口
		$("#tranList").on("click","a[name='deleteA']",function (){
			var tranId = $(this).attr("value");
			$("#tranIdHide").val(tranId);
			$("#removeTransactionModal").modal("show");
		});
		//删除交易
		$("#deleteTranBtn").click(function (){
			var tranId = $("#tranIdHide").val();
			$.ajax({
				url:"${pageContext.request.contextPath}/tran/deleteTranById",
				data:{
					tranId:tranId
				},
				type:"post",
				dataType:"json",
				success:function (data){
					if (data.errorCode=="1"){
						$("#tr_"+tranId).remove();
						$("#removeTransactionModal").modal("hide");
					}else{
						$("#removeTransactionModal").modal("hide");
						alert(data.errorMessage);
					}
				}
			});
		});
		//弹出创建联系人模态窗口
		$("#createContactsA").click(function (){
			$("#createContactsForm")[0].reset();
			$("#create-customerName").val("${customer.name}")
			$("#createContactsModal").modal("show");
		});
		//创建联系人
		$("#saveContactsBtn").click(function (){
			var owner = $("#create-owner").val();
			var source = $("#create-source").val();
			var fullname = $.trim($("#create-fullname").val());
			var appellation = $("#create-appellation").val();
			var job = $("#create-job").val();
			var mphone = $("#create-mphone").val();
			var email = $("#create-email").val();
			var customerId = $("#create-customerName").val();
			var description = $("#create-description").val();
			var contactSummary = $("#create-contactSummary").val();
			var nextContactTime = $("#create-nextContactTime").val();
			var address = $("#create-address").val();
			if (fullname==""){
				alert("姓名不能为空！");
				return;
			}
			var email_regx=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
			if(!email_regx.test(email)){
				alert("邮箱格式不正确！");
				return;
			}
			var mphone_regx=/^1[3456789]\d{9}$/;
			if(!mphone_regx.test(mphone)){
				alert("手机格式不正确！");
				return;
			}
			var lis="";
			$.ajax({
				url:"${pageContext.request.contextPath}/customer/insertOneContactsByContacts",
				data:{
					owner           :owner          ,
					source          :source         ,
					fullname        :fullname       ,
					appellation     :appellation    ,
					job             :job            ,
					mphone          :mphone         ,
					email           :email          ,
					customerId      :customerId     ,
					description     :description    ,
					contactSummary  :contactSummary ,
					nextContactTime :nextContactTime,
					address         :address
				},
				type:"post",
				dataType:"json",
				success:function (data){
					if (data.errorInfo.errorCode=="1"){
						var contacts = data.contacts;
						lis+="<tr id=\"tr_"+contacts.id+"\">";
						lis+="<td><a href=\"../contacts/detail.jsp\" style=\"text-decoration: none;\">"+contacts.fullname+"</a></td>";
						lis+="<td>"+contacts.email+"</td>";
						lis+="<td>"+contacts.mphone+"</td>";
						lis+="<td><a href=\"javascript:void(0);\" contactsId=\""+contacts.id+"\" name=\"deleteContactsA\" style=\"text-decoration: none;\"><span class=\"glyphicon glyphicon-remove\"></span>删除</a></td>";
						lis+="</tr>";
						$("#contactsList").prepend(lis);
						$("#createContactsModal").modal("hide");
					}else{
						$("#createContactsModal").modal("hide");
						alert(data.errorInfo.errorMessage);
					}
				}
			});
		});
		//弹出删除联系人窗口
		$("#contactsList").on("click","a[name='deleteContactsA']",function (){
			var contactsId = $(this).attr("contactsId");
			$("#contactsId").val(contactsId);
			$("#removeContactsModal").modal("show");
		});
		//删除联系人
		$("#deleteContactsBtn").click(function (){
			var contactsId = $("#contactsId").val();
			$.ajax({
				url:"${pageContext.request.contextPath}/customer/deleteOneContactsById",
				data:{
					contactsId:contactsId
				},
				type:"post",
				dataType:"json",
				success:function (data){
					if (data.errorCode=="1"){
						$("#tr_"+contactsId).remove();
						$("#removeContactsModal").modal("hide");
					}else{
						$("#removeContactsModal").modal("hide");
						alert(data.errorMessage);
					}
				}
			});
		});
	});
	function scrollToTop() {
		// 获取当前滚动位置
		const currentPosition = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
		// 计算滚动距离和持续时间
		const distance = currentPosition;
		const duration = 500; // 持续时间，单位：毫秒
		// 定义滚动动画函数
		function scrollToTopAnimation(startTime) {
			const currentTime = Date.now();
			const elapsed = currentTime - startTime;
			// 计算当前滚动位置
			const position = easeInOutCubic(elapsed, currentPosition, -currentPosition, duration);
			// 滚动到指定位置
			window.scrollTo(0, position);
			// 继续滚动直到持续时间结束
			if (elapsed < duration) {
				requestAnimationFrame(scrollToTopAnimation.bind(null, startTime));
			}
		}
		// 定义缓动函数，使滚动过程更加平滑
		function easeInOutCubic(t, b, c, d) {
			t /= d / 2;
			if (t < 1) {
				return c / 2 * t * t * t + b;
			}
			t -= 2;
			return c / 2 * (t * t * t + 2) + b;
		}
		// 开始滚动动画
		requestAnimationFrame(scrollToTopAnimation.bind(null, Date.now()));
	}
</script>

</head>
<body>
<!-- 修改备注的模态窗口 -->
	<div class="modal fade" id="editRemarkModal" role="dialog">
		<%-- 备注的id --%>
		<input type="hidden" id="remarkId">
		<div class="modal-dialog" role="document" style="width: 40%;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title" id="myModalLabel">修改备注</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" role="form">
						<input type="hidden" id="hiddenId">
						<div class="form-group">
							<label for="noteContent" class="col-sm-2 control-label">内容</label>
							<div class="col-sm-10" style="width: 81%;">
								<textarea class="form-control" rows="3" id="noteContent"></textarea>
							</div>
						</div>
					</form>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="button" class="btn btn-primary" id="updateRemarkBtn">更新</button>
				</div>
			</div>
		</div>
	</div>
	<!-- 删除联系人的模态窗口 -->
	<div class="modal fade" id="removeContactsModal" role="dialog">
		<div class="modal-dialog" role="document" style="width: 30%;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title">删除联系人</h4>
				</div>
				<div class="modal-body">
					<p>您确定要删除该联系人吗？</p>
				</div>
				<div class="modal-footer">
					<input type="hidden" id="contactsId">
					<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					<button type="button" class="btn btn-danger" id="deleteContactsBtn">删除</button>
				</div>
			</div>
		</div>
	</div>

    <!-- 删除交易的模态窗口 -->
    <div class="modal fade" id="removeTransactionModal" role="dialog">
        <div class="modal-dialog" role="document" style="width: 30%;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">×</span>
                    </button>
                    <h4 class="modal-title">删除交易</h4>
                </div>
                <div class="modal-body">
                    <p>您确定要删除该交易吗？</p>
                </div>
                <div class="modal-footer">
					<input type="hidden" id="tranIdHide">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-danger" id="deleteTranBtn">删除</button>
                </div>
            </div>
        </div>
    </div>
	
	<!-- 创建联系人的模态窗口 -->
	<div class="modal fade" id="createContactsModal" role="dialog">
		<div class="modal-dialog" role="document" style="width: 85%;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" onclick="$('#createContactsModal').modal('hide');">
						<span aria-hidden="true">×</span>
					</button>
					<h4 class="modal-title" id="myModalLabel1">创建联系人</h4>
				</div>
				<div class="modal-body">
					<form id="createContactsForm" class="form-horizontal" role="form">
					
						<div class="form-group">
							<label for="create-owner" class="col-sm-2 control-label">所有者<span style="font-size: 15px; color: red;">*</span></label>
							<div class="col-sm-10" style="width: 300px;">
								<select class="form-control" id="create-owner">
									<c:forEach items="${userList}" var="user">
								  		<option value="${user.id}">${user.name}</option>
									</c:forEach>
								</select>
							</div>
							<label for="create-source" class="col-sm-2 control-label">来源</label>
							<div class="col-sm-10" style="width: 300px;">
								<select class="form-control" id="create-source">
								  <option></option>
									<c:forEach items="${sourceList}" var="source">
								  		<option value="${source.id}">${source.value}</option>
									</c:forEach>
								</select>
							</div>
						</div>
						
						<div class="form-group">
							<label for="create-fullname" class="col-sm-2 control-label">姓名<span style="font-size: 15px; color: red;">*</span></label>
							<div class="col-sm-10" style="width: 300px;">
								<input type="text" class="form-control" id="create-fullname">
							</div>
							<label for="create-appellation" class="col-sm-2 control-label">称呼</label>
							<div class="col-sm-10" style="width: 300px;">
								<select class="form-control" id="create-appellation">
								  <option></option>
									<c:forEach items="${appellationList}" var="appellation">
								  		<option value="${appellation.id}">${appellation.value}</option>
									</c:forEach>
								</select>
							</div>
							
						</div>
						
						<div class="form-group">
							<label for="create-job" class="col-sm-2 control-label">职位</label>
							<div class="col-sm-10" style="width: 300px;">
								<input type="text" class="form-control" id="create-job">
							</div>
							<label for="create-mphone" class="col-sm-2 control-label">手机</label>
							<div class="col-sm-10" style="width: 300px;">
								<input type="text" class="form-control" id="create-mphone">
							</div>
						</div>
						
						<div class="form-group" style="position: relative;">
							<label for="create-email" class="col-sm-2 control-label">邮箱</label>
							<div class="col-sm-10" style="width: 300px;">
								<input type="text" class="form-control" id="create-email">
							</div>
							<label for="create-birth" class="col-sm-2 control-label">生日</label>
							<div class="col-sm-10" style="width: 300px;">
								<input type="text" class="form-control mydateDown" id="create-birth" readonly>
							</div>
						</div>
						
						<div class="form-group" style="position: relative;">
							<label for="create-customerName" class="col-sm-2 control-label">客户名称</label>
							<div class="col-sm-10" style="width: 300px;">
								<input type="text" class="form-control" id="create-customerName" placeholder="支持自动补全，输入客户不存在则新建" readonly>
							</div>
						</div>
						
						<div class="form-group" style="position: relative;">
							<label for="create-description" class="col-sm-2 control-label">描述</label>
							<div class="col-sm-10" style="width: 81%;">
								<textarea class="form-control" rows="3" id="create-description"></textarea>
							</div>
						</div>
						
						<div style="height: 1px; width: 103%; background-color: #D5D5D5; left: -13px; position: relative;"></div>

                        <div style="position: relative;top: 15px;">
                            <div class="form-group">
                                <label for="create-contactSummary" class="col-sm-2 control-label">联系纪要</label>
                                <div class="col-sm-10" style="width: 81%;">
                                    <textarea class="form-control" rows="3" id="create-contactSummary"></textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="create-nextContactTime" class="col-sm-2 control-label">下次联系时间</label>
                                <div class="col-sm-10" style="width: 300px;">
                                    <input type="text" class="form-control mydateDown" id="create-nextContactTime" readonly>
                                </div>
                            </div>
                        </div>

                        <div style="height: 1px; width: 103%; background-color: #D5D5D5; left: -13px; position: relative; top : 10px;"></div>

                        <div style="position: relative;top: 20px;">
                            <div class="form-group">
                                <label for="create-address" class="col-sm-2 control-label">详细地址</label>
                                <div class="col-sm-10" style="width: 81%;">
                                    <textarea class="form-control" rows="1" id="create-address"></textarea>
                                </div>
                            </div>
                        </div>
					</form>
					
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					<button type="button" class="btn btn-primary" id="saveContactsBtn">保存</button>
				</div>
			</div>
		</div>
	</div>
	
	

	<!-- 返回按钮 -->
	<div style="position: relative; top: 35px; left: 10px;">
		<a href="javascript:void(0);" onclick="window.history.back();"><span class="glyphicon glyphicon-arrow-left" style="font-size: 20px; color: #DDDDDD"></span></a>
	</div>
	
	<!-- 大标题 -->
	<div style="position: relative; left: 40px; top: -30px;">
		<div class="page-header">
			<h3>${customer.name} <small><a href="http://www.baidu.com" target="_blank">${customer.website}</a></small></h3>
		</div>
<%--		<div style="position: relative; height: 50px; width: 500px;  top: -72px; left: 700px;">--%>
<%--			<button type="button" class="btn btn-default" data-toggle="modal" data-target="#editCustomerModal"><span class="glyphicon glyphicon-edit"></span> 编辑</button>--%>
<%--			<button type="button" class="btn btn-danger"><span class="glyphicon glyphicon-minus"></span> 删除</button>--%>
<%--		</div>--%>
	</div>
	
	<br/>
	<br/>
	<br/>

	<!-- 详细信息 -->
	<div style="position: relative; top: -70px;">
		<div style="position: relative; left: 40px; height: 30px;">
			<div style="width: 300px; color: gray;">所有者</div>
			<div style="width: 300px;position: relative; left: 200px; top: -20px;"><b>${customer.owner}</b></div>
			<div style="width: 300px;position: relative; left: 450px; top: -40px; color: gray;">名称</div>
			<div style="width: 300px;position: relative; left: 650px; top: -60px;"><b>${customer.name}</b></div>
			<div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px;"></div>
			<div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px; left: 450px;"></div>
		</div>
		<div style="position: relative; left: 40px; height: 30px; top: 10px;">
			<div style="width: 300px; color: gray;">公司网站</div>
			<div style="width: 300px;position: relative; left: 200px; top: -20px;"><b>${customer.website}</b></div>
			<div style="width: 300px;position: relative; left: 450px; top: -40px; color: gray;">公司座机</div>
			<div style="width: 300px;position: relative; left: 650px; top: -60px;"><b>${customer.phone}</b></div>
			<div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px;"></div>
			<div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px; left: 450px;"></div>
		</div>
		<div style="position: relative; left: 40px; height: 30px; top: 20px;">
			<div style="width: 300px; color: gray;">创建者</div>
			<div style="width: 500px;position: relative; left: 200px; top: -20px;"><b>${customer.createBy}&nbsp;&nbsp;</b><small style="font-size: 10px; color: gray;">${customer.createTime}</small></div>
			<div style="height: 1px; width: 550px; background: #D5D5D5; position: relative; top: -20px;"></div>
		</div>
		<div style="position: relative; left: 40px; height: 30px; top: 30px;">
			<div style="width: 300px; color: gray;">修改者</div>
			<div style="width: 500px;position: relative; left: 200px; top: -20px;"><b>${customer.editBy}&nbsp;&nbsp;</b><small style="font-size: 10px; color: gray;">${customer.editTime}</small></div>
			<div style="height: 1px; width: 550px; background: #D5D5D5; position: relative; top: -20px;"></div>
		</div>
        <div style="position: relative; left: 40px; height: 30px; top: 40px;">
            <div style="width: 300px; color: gray;">联系纪要</div>
            <div style="width: 630px;position: relative; left: 200px; top: -20px;">
                <b>
					${customer.contactSummary}
                </b>
            </div>
            <div style="height: 1px; width: 850px; background: #D5D5D5; position: relative; top: -20px;"></div>
        </div>
        <div style="position: relative; left: 40px; height: 30px; top: 50px;">
            <div style="width: 300px; color: gray;">下次联系时间</div>
            <div style="width: 300px;position: relative; left: 200px; top: -20px;"><b>${customer.nextContactTime}</b></div>
            <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -20px; "></div>
        </div>
		<div style="position: relative; left: 40px; height: 30px; top: 60px;">
			<div style="width: 300px; color: gray;">描述</div>
			<div style="width: 630px;position: relative; left: 200px; top: -20px;">
				<b>
					${customer.description}
				</b>
			</div>
			<div style="height: 1px; width: 850px; background: #D5D5D5; position: relative; top: -20px;"></div>
		</div>
        <div style="position: relative; left: 40px; height: 30px; top: 70px;">
            <div style="width: 300px; color: gray;">详细地址</div>
            <div style="width: 630px;position: relative; left: 200px; top: -20px;">
                <b>
					${customer.address}
                </b>
            </div>
            <div style="height: 1px; width: 850px; background: #D5D5D5; position: relative; top: -20px;"></div>
        </div>
	</div>
	
	<!-- 备注 -->
	<div id="remarkFatherDiv" style="position: relative; top: 10px; left: 40px;">
		<div id="remarkBeforeDiv" class="page-header">
			<h4>备注</h4>
		</div>
		<c:forEach items="${customerRemarkList}" var="remark">
			<div id="firstDiv_${remark.id}" class="remarkDiv" style="height: 60px;">
				<img title="${remark.createBy}" src="${pageContext.request.contextPath}/image/user-thumbnail.png" style="width: 30px; height:30px;">
				<div style="position: relative; top: -40px; left: 40px;" >
					<h5 id="h5_${remark.id}">${remark.noteContent}</h5>
					<font color="gray">客户</font> <font color="gray">-</font> <b>${customer.name}</b> <small id="small_${remark.id}" style="color: gray;"> ${remark.editFlag=='0' ? remark.createTime:remark.editTime} 由${remark.editFlag=='0' ? remark.createBy:remark.editBy}${remark.editFlag=='0' ? '创建':'修改'}</small>
					<div style="position: relative; left: 500px; top: -30px; height: 30px; width: 100px; display: none;">
						<a class="myHref" name="editA" remarkId="${remark.id}" href="javascript:void(0);"><span class="glyphicon glyphicon-edit" style="font-size: 20px; color: #E6E6E6;"></span></a>
						&nbsp;&nbsp;&nbsp;&nbsp;
						<a class="myHref" name="deleteA" remarkId="${remark.id}" href="javascript:void(0);"><span class="glyphicon glyphicon-remove" style="font-size: 20px; color: #E6E6E6;"></span></a>
					</div>
				</div>
			</div>
		</c:forEach>
		<!-- 备注1 -->
<%--		<div class="remarkDiv" style="height: 60px;">--%>
<%--			<img title="zhangsan" src="${pageContext.request.contextPath}/image/user-thumbnail.png" style="width: 30px; height:30px;">--%>
<%--			<div style="position: relative; top: -40px; left: 40px;" >--%>
<%--				<h5>哎呦！</h5>--%>
<%--				<font color="gray">客户</font> <font color="gray">-</font> <b>北京动力节点</b> <small style="color: gray;"> 2017-01-22 10:10:10 由zhangsan</small>--%>
<%--				<div style="position: relative; left: 500px; top: -30px; height: 30px; width: 100px; display: none;">--%>
<%--					<a class="myHref" href="javascript:void(0);"><span class="glyphicon glyphicon-edit" style="font-size: 20px; color: #E6E6E6;"></span></a>--%>
<%--					&nbsp;&nbsp;&nbsp;&nbsp;--%>
<%--					<a class="myHref" href="javascript:void(0);"><span class="glyphicon glyphicon-remove" style="font-size: 20px; color: #E6E6E6;"></span></a>--%>
<%--				</div>--%>
<%--			</div>--%>
<%--		</div>--%>
		
		<!-- 备注2 -->
<%--		<div class="remarkDiv" style="height: 60px;">--%>
<%--			<img title="zhangsan" src="${pageContext.request.contextPath}/image/user-thumbnail.png" style="width: 30px; height:30px;">--%>
<%--			<div style="position: relative; top: -40px; left: 40px;" >--%>
<%--				<h5>呵呵！</h5>--%>
<%--				<font color="gray">客户</font> <font color="gray">-</font> <b>北京动力节点</b> <small style="color: gray;"> 2017-01-22 10:20:10 由zhangsan</small>--%>
<%--				<div style="position: relative; left: 500px; top: -30px; height: 30px; width: 100px; display: none;">--%>
<%--					<a class="myHref" href="javascript:void(0);"><span class="glyphicon glyphicon-edit" style="font-size: 20px; color: #E6E6E6;"></span></a>--%>
<%--					&nbsp;&nbsp;&nbsp;&nbsp;--%>
<%--					<a class="myHref" href="javascript:void(0);"><span class="glyphicon glyphicon-remove" style="font-size: 20px; color: #E6E6E6;"></span></a>--%>
<%--				</div>--%>
<%--			</div>--%>
<%--		</div>--%>
		
		<div id="remarkDiv" style="background-color: #E6E6E6; width: 870px; height: 90px;">
			<form role="form" style="position: relative;top: 10px; left: 10px;">
				<textarea id="remark" class="form-control" style="width: 850px; resize : none;" rows="2"  placeholder="添加备注..."></textarea>
				<p id="cancelAndSaveBtn" style="position: relative;left: 737px; top: 10px; display: none;">
					<button id="cancelBtn" type="button" class="btn btn-default">取消</button>
					<button type="button" class="btn btn-primary" id="saveRemarkBtn">保存</button>
				</p>
			</form>
		</div>
	</div>
	
	<!-- 交易 -->
	<div>
		<div style="position: relative; top: 20px; left: 40px;">
			<div class="page-header">
				<h4>交易</h4>
			</div>
			<div style="position: relative;top: 0px;">
				<table id="activityTable2" class="table table-hover" style="width: 900px;">
					<thead>
						<tr style="color: #B3B3B3;">
							<td>名称</td>
							<td>金额</td>
							<td>阶段</td>
							<td>可能性</td>
							<td>预计成交日期</td>
							<td>类型</td>
							<td></td>
						</tr>
					</thead>
					<tbody id="tranList">
					<c:forEach items="${tranList}" var="tran">
						<tr id="tr_${tran.id}">
							<td><a href="${pageContext.request.contextPath}/tran/getDetailTran?id=${tran.id}" style="text-decoration: none;">${tran.customerId}-${tran.name}</a></td>
							<td>${tran.money}</td>
							<td>${tran.stage}</td>
							<td>${tran.possibility}</td>
							<td>${tran.expectedDate}</td>
							<td>${tran.type}</td>
							<td><a href="javascript:void(0);" name="deleteA" value="${tran.id}" style="text-decoration: none;"><span class="glyphicon glyphicon-remove"></span>删除</a></td>
						</tr>
					</c:forEach>
<%--						<tr>--%>
<%--							<td><a href="../transaction/detail.jsp" style="text-decoration: none;">动力节点-交易01</a></td>--%>
<%--							<td>5,000</td>--%>
<%--							<td>谈判/复审</td>--%>
<%--							<td>90</td>--%>
<%--							<td>2017-02-07</td>--%>
<%--							<td>新业务</td>--%>
<%--							<td><a href="javascript:void(0);" data-toggle="modal" data-target="#removeTransactionModal" style="text-decoration: none;"><span class="glyphicon glyphicon-remove"></span>删除</a></td>--%>
<%--						</tr>--%>
					</tbody>
				</table>
			</div>
			
			<div>
				<a href="${pageContext.request.contextPath}/customer/toSaveTran?currentCustomerId=${customer.id}&currentCustomerName=${customer.name}" style="text-decoration: none;"><span class="glyphicon glyphicon-plus"></span>新建交易</a>
			</div>
		</div>
	</div>
	
	<!-- 联系人 -->
	<div>
		<div style="position: relative; top: 20px; left: 40px;">
			<div class="page-header">
				<h4>联系人</h4>
			</div>
			<div style="position: relative;top: 0px;">
				<table id="activityTable" class="table table-hover" style="width: 900px;">
					<thead>
						<tr style="color: #B3B3B3;">
							<td>名称</td>
							<td>邮箱</td>
							<td>手机</td>
							<td></td>
						</tr>
					</thead>
					<tbody id="contactsList">
					<c:forEach items="${contactsList}" var="con">
						<tr id="tr_${con.id}">
							<td><a href="../contacts/detail.jsp" style="text-decoration: none;">${con.fullname}</a></td>
							<td>${con.email}</td>
							<td>${con.mphone}</td>
							<td><a href="javascript:void(0);" contactsId="${con.id}" name="deleteContactsA" style="text-decoration: none;"><span class="glyphicon glyphicon-remove"></span>删除</a></td>
						</tr>
					</c:forEach>
<%--						<tr>--%>
<%--							<td><a href="../contacts/detail.jsp" style="text-decoration: none;">李四</a></td>--%>
<%--							<td>lisi@bjpowernode.com</td>--%>
<%--							<td>13543645364</td>--%>
<%--							<td><a href="javascript:void(0);" data-toggle="modal" data-target="#removeContactsModal" style="text-decoration: none;"><span class="glyphicon glyphicon-remove"></span>删除</a></td>--%>
<%--						</tr>--%>
					</tbody>
				</table>
			</div>
			
			<div>
				<a href="javascript:void(0);" id="createContactsA" style="text-decoration: none;"><span class="glyphicon glyphicon-plus"></span>新建联系人</a>
			</div>
		</div>
	</div>
	
	<div style="height: 200px;"></div>
</body>
</html>